window.onload = function () {
    var mySwiper = new Swiper('#swiper', {
        autoplay: {
            delay: 6000,
            stopOnLastSlide: false,
            disableOnInteraction: true,
        },
        loop: true, // 循环模式选项
        //是否禁止滑动
        noSwiping: true,
        //禁止滑动的类名
        noSwipingClass: 'stop-swiping',
        // 如果需要分页器
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
        effect: 'fade', //渐变
        // 如果需要前进后退按钮
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },

    })
    //鼠标覆盖停止自动切换
    mySwiper.el.onmouseover = function () {
        mySwiper.autoplay.stop();
    }

    //鼠标离开开始自动切换
    mySwiper.el.onmouseout = function () {
        mySwiper.autoplay.start();
    }
    //第二个轮播图
    var swiper2 = new Swiper('#swiper2', {
        speed:1000,
        slidesPerView: 4,
        spaceBetween: 16,
        slidesPerGroup: 4,
        noSwiping: true,
        noSwipingClass: 'stop-swiping',
        navigation: {
            nextEl: '.swiperControls .swiper-button-next',
            prevEl: '.swiperControls .swiper-button-prev',
        },
    });
}